#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.db.models import QuerySet

from web.manager.log_manager import LogManager
from web.service.base_service import BaseService

Logger = LogManager.get_logger(__name__)

"""
CommodityFutureInfo的service类
"""


class CommodityFutureInfoService(BaseService):

    def add_oracle_column_comment(self):
        """
        为表commodity_future_info添加注释
        """

        Logger.info('为表commodity_future_info添加注释')

        self.commodity_future_info_dao.add_oracle_column_comment()

    def find_all(self) -> QuerySet:
        """
        查询所有记录
        """

        return self.commodity_future_info_dao.find_all()

    def find_for_hmm(self):
        """
        为隐马尔可夫算法收集数据
        """

        return self.commodity_future_info_dao.find_for_hmm()

    def concatenate_commodity_future_exchange_code_and_commodity_future_info_code_by_commodity_future_info_code(self, code):
        """
        根据code，链接commodity_future_exchange表的code字段和commodity_future_info表的code字段
        """

        return self.commodity_future_info_dao.concatenate_commodity_future_exchange_code_and_commodity_future_info_code_by_commodity_future_info_code(code)
